<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ckeditor</title>
<script src="../bootstrap/js/jquery-1.8.2.min.js" type="text/javascript"></script>
<script src="ckeditor.js" type="text/javascript"></script>
<script>
	$(function() {
		CKEDITOR.replace('context', {
			toolbar : [ [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ], [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Print', 'SpellChecker', 'Scayt' ],
					[ 'Undo', 'Redo', '-', 'Find', 'Replace', '-', 'SelectAll', 'RemoveFormat' ],
					[ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ],
					[ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript' ], [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote' ],
					[ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ], [ 'Link', 'Unlink', 'Anchor' ],
					[ 'Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak' ], [ 'Styles', 'Format', 'Font', 'FontSize' ], [ 'TextColor', 'BGColor', '-', 'ShowBlocks' ] ],
			uiColor : '#9AB8F3',
			height : 300
		});
		var pIframe = $("iframe", parent.document);
		pIframe.css({
			height : 460,
			width : "100%",
			border : "none",
			visibility : "visible"
		});
		var pTextarea = $("textarea[name=" + pIframe.attr("name") + "]", parent.document);
		$("body").mouseover(function() {
			var innerIframe = $("iframe.cke_wysiwyg_frame").contents().find("body");
			innerIframe.on("keyup mouseup mouseout", function() {
				pTextarea.val($(this).html());
				pIframe.css("height", ($("#cke_1_contents").height() + 160) + "px");
			});
			//pIframe.css("height", ($("#cke_1_contents").height() + 160) + "px");
			$("#cke_1_bottom").on("mouseup mouseout", function() {
				pIframe.css("height", ($("#cke_1_contents").height() + 160) + "px");
			});
		});
		$(document).scroll(function() {
			pIframe.css("height", ($("#cke_1_contents").height() + 160) + "px");
		});
		$(".cke_dialog_body").live("mouseover", function() {
			pIframe.css("height", $(document).scroll().height() + "px");
		});
	});
</script>
</head>
<body>
	<textarea rows="" name="context" cols=""></textarea>
</body>
</html>